/**
 * @(#)SpringController.java, 2010-5-13. 
 * 
 * Copyright 2010 Youdao, Inc. All rights reserved.
 * YOUDAO PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.rsstuan.web.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;



import com.rsstuan.utils.CityUtils;

/**
 *
 * @author guosq
 *
 */
public class SpringController extends MultiActionController{
    
	
	protected ModelAndView internalCreateModelAndView(HttpServletRequest request,
            HttpServletResponse response, String view, Map<String, Object> model) {
        return new ModelAndView(view, model);
    }
    
	 protected ModelAndView createModelAndView(HttpServletRequest request,
	            HttpServletResponse response, String view, Map<String, Object> model){
		 return internalCreateModelAndView(request,response, view, model);
	 }
    protected ModelAndView createModelAndView(HttpServletRequest request,
            HttpServletResponse response, String view, Object... values) {
        Map<String, Object> model = new HashMap<String, Object>();
    	assert (values.length % 2 == 0);
        for (int i = 0; i < values.length; i ++) {
        	String key = String.valueOf(values[i++]);
        	model.put(key, values[i]);
        }
        return new ModelAndView(view, model);
    }
    
    protected void renderText(HttpServletResponse response, String text) {
       try {
           response.getWriter().write(text);
       } catch (Exception e) {}
    }

}
